/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controls;

import java.sql.*;

/**
 *
 * @author Ahm
 */
public class giriskontrol {

    public String[] giriskontrol(String kullaniciadi, String sifre) {
        String[] dizi = new String[10];
        dizi[0]= "2";
        try {
            controls.SQLConnection  sqlconnect = new controls.SQLConnection();
            Statement komut = sqlconnect.GetUserTableConnection();
            ResultSet sonuc = komut.executeQuery("SELECT * FROM usertable WHERE UserName='" + kullaniciadi + "'and Password ='" + sifre + "'");
            while (sonuc.next()) {
                 dizi[0]= "1";
                 dizi[1]= (sonuc.getString("id"));
                 System.out.println("giriskontrol'de: "+sonuc.getString("id"));
                 dizi[2]= (sonuc.getString("Authority"));
                 dizi[3]= (sonuc.getString("RealName"));
                 dizi[4]= (sonuc.getString("StudentNumber"));
                 dizi[5]= (sonuc.getString("UserName"));
               // String [] Groups2 = sonuc.getString("Groups").split(";");
       //Group işi yapılamadı
                //      int [] Groups = net int[Groups2.length];
          //      for (int i = 0; i < Groups2.length; i++) {
          //     Groups[i] = Integer.parseInt(Groups2[i]);
         //       }
            }


        } catch (Exception e) {
        }
        return dizi;
    }
}
